get type of exception c#

59

get type of exception c# -

try
{
    // do something here
}
catch(Exception ex)
{
	// will print System.NullReferenceException for example
    Console.WriteLine(ex.GetType().ToString());
}

Comments

Submit
0 Comments